package com.wangp.mywrite.coding;

/**
 * @author: wp
 * @date: 2023/5/9 14:22:53
 * @desc:
 **/
public class CountTime {

    public int countTime(String time) {
        String[] split = time.split(":");
        String hours = split[0];
        String minutes = split[1];

        int hourCount = 0;
        if("??".equals(hours)){
            hourCount = 24;
        }
        else if(!hours.contains("?")){
            hourCount = 1;
        }
        else if(hours.charAt(0) == '?'&&hours.charAt(1) <= '3'){
            hourCount = 3;
        }
        else if(hours.charAt(0) == '?' && hours.charAt(1) > '3'){
            hourCount = 2;
        }
        else if(hours.charAt(1) == '?'&& hours.charAt(0) < '2'){
            hourCount = 10;
        }
        else if(hours.charAt(1) == '?' && hours.charAt(0) == '2'){
            hourCount = 4;
        }


        int minCount = 0;
        if("??".equals(minutes)){
            minCount = 60;
        }
        else if(!minutes.contains("?")){
            minCount = 1;
        }
        else if(minutes.charAt(0) == '?'){
            minCount = 6;
        }
        else if(minutes.charAt(1) == '?' ){
            minCount = 10;
        }
        return hourCount * minCount;
    }
}
